package org.springblade.modules.digitalization.utils;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import org.springblade.core.tool.utils.Func;

import java.util.ArrayList;
import java.util.List;

//监听器
public class UserListener extends AnalysisEventListener<A01A02Entity> {

    private List<A01A02Entity> a01A02EntityList=new ArrayList<>();



    public List<A01A02Entity> getA01A02EntityList(){
        return a01A02EntityList;
    }
    //一行一行读取
    @Override
    public void invoke(A01A02Entity a01A02Entity, AnalysisContext analysisContext) {
		if(Func.isBlank(a01A02Entity.getA0184())){
			//身份证校验
			a01A02Entity.setResult(false);
			a01A02Entity.setReason("身份证号为空");
		}else if(Func.isBlank(a01A02Entity.getB0101())){
			//姓名校验
			a01A02Entity.setResult(false);
			a01A02Entity.setReason("姓名为空");
		}else{
			a01A02Entity.setZipFileName(a01A02Entity.getB0101()+a01A02Entity.getA0184()+".zip");
		}
        //调用方法添加数据库
		if(Func.isBlank(a01A02Entity.getB0101())&&Func.isBlank(a01A02Entity.getA0184())&&Func.isBlank(a01A02Entity.getA0201A())&&Func.isBlank(a01A02Entity.getA0201B())){

		}else{
			a01A02EntityList.add(a01A02Entity);
		}

    }
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
